package bookmanagementsystem.gui;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class LoginChoiceFrame extends JFrame {

    public LoginChoiceFrame() {
        setTitle("图书管理系统 - 选择登录身份");
        setSize(400, 300);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        JPanel panel = new JPanel(new GridLayout(2, 1, 10, 10));

        JButton adminLoginButton = new JButton("管理员登录");
        JButton userLoginButton = new JButton("用户登录");

        panel.add(adminLoginButton);
        panel.add(userLoginButton);

        getContentPane().add(panel);

        // 管理员登录按钮
        adminLoginButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                dispose();
                new AdminLoginFrame().setVisible(true);
            }
        });

        // 用户登录按钮
        userLoginButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                dispose();
                new LoginFrame().setVisible(true);
            }
        });

        setVisible(true);
    }

    public static void main(String[] args) {

        LoginChoiceFrame ChoiceloginFrame = new LoginChoiceFrame();
    }
}